<template>
  <div id="app">
    <div class="main">
      <div class="left">
        <div v-for="(item,index) of menus" :key="'menu-'+index" class="menu-item">
          <router-link :to="{path:item.path}">{{ item.title }}</router-link>
        </div>
      </div>
      <div class="right">
        <div class="content">
          <!-- 主应用router-view -->
          <router-view v-show="$route.name" />
          <!-- 乾坤容器 -->
          <div v-show="!$route.name" id="container" />
        </div>
      </div>
    </div>
  </div>
</template>

<script>

export default {
  name: 'App',
  components: {
  },
  data() {
  /**
    * 菜单列表
    * key: 唯一 Key 值
    * title: 菜单标题
    * path: 菜单对应的路径
    */
    const menus = [
      {
        key: 'Home',
        title: '主页',
        path: '/'
      },
      {
        key: 'VueMicroApp',
        title: 'Vue 主页',
        path: '/vue'
      },
      {
        key: 'VueMicroAppList',
        title: 'Vue 列表页',
        path: '/vue/list'
      }
    ]
    return { menus }
  }
}
</script>

<style lang="scss">
html,body{
  margin: 0;
  padding:0;
  width:100%;
  height:100%;
}
* {
  box-sizing: border-box;
}
#app {
  font-family: Avenir, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  color: #2c3e50;
  width: 100%;
  height:100%;
}
$left-width:320px;
.main{
  width:100%;
  height:100%;
  .left{
    top:0;
    left:0;
    height:100%;
    width:$left-width;
    position: absolute;
    background-color:#2c3e50;
    padding: 10px 0;
    .menu-item{
      border:1px solid #e2e2e2;
      border-left:0;
      border-right:0;
      border-bottom: 0;
      height:35px;
      width:100%;
      font-size:18px;
      color:#efefef;
      line-height: 35px;
      padding-left: 20px;
      padding-right: 20px;
      &.active{
        background-color:dodgerblue;
        color:#efefef;
        border-color:dodgerblue;
      }

    }
    .menu-item:last-child{
      border-bottom: 1px solid #e2e2e2;
    }
  }
  .right {
    width:100%;
    height:100%;
    padding-left: $left-width;
    .content{
      width:100%;
      height:100%;
      padding:10px;
    }
  }
}
</style>
